 <template>
 	<view class="container">
 		<page-nav class="custom-title" title="企业认证" :leftShow="true"> </page-nav>
 		<view style="background-color:  #F3F5FC ; height: 100vh;">
 			 
 				<view style="padding-top: 30rpx; background-color:  #fff;">
					<view style="padding-bottom: 30rpx; background-color:  #fff;">
						<u-steps :current="currentidx">
							<u-steps-item title="个人认证" desc=""></u-steps-item>
							<u-steps-item title="企业认证" desc=""></u-steps-item>
							<u-steps-item title="审核" desc=""></u-steps-item>
						</u-steps>
					</view>
 					 

 				<view style="height: 30rpx; background-color: #F3F5FC;"></view>
				<view  v-if="currentidx==0">
 					<view style="padding: 20rpx 20rpx 20rpx 20rpx;">上传身份证
 						<view style="display: flex;justify-content: space-between; padding: 30rpx 10rpx 30rpx 10rpx;">
 							<!-- 		<u-upload :fileList="fileList5" @afterRead="afterRead"
							@delete="deletePic" name="5" multiple :maxCount="1"></u-upload> -->
 							<u-upload :fileList="fileList6" @afterRead="afterRead" @delete="deletePic" name="6"
 								multiple :maxCount="1" width="150" height="70">
 								<image src="https://www.xrskfw.com/static/images/user/sfz_rx.png" mode="widthFix"
 									style="width: 155px; "></image>
 							</u-upload>
 							<u-upload :fileList="fileList6" @afterRead="afterRead" @delete="deletePic" name="6"
 								multiple :maxCount="1" width="150" height="70">
 								<image src="https://www.xrskfw.com/static/images/user/sfz_gh.png" mode="widthFix"
 									style="width: 155px; "></image>
 							</u-upload>
 						</view>

 						<view class="uni-form-item">
 							<view class="uni-form-item-label uni-form-item-required">姓名</view>
 							<view class="uni-form-item-input">
 								<input class="uni-input" placeholder="请输入姓名" :placeholder-style="placeholderStyle"
 									:disabled="readonly" />
 							</view>
 						</view>
 						<view class="uni-form-item">
 							<view class="uni-form-item-label uni-form-item-required">身份证号</view>
 							<view class="uni-form-item-input">
 								<input class="uni-input" placeholder="请输入身份证号" :placeholder-style="placeholderStyle"
 									:disabled="readonly" />
 							</view>
 						</view>

 					</view>
 					<view style="height: 30rpx; background-color: #F3F5FC;"></view>

 					<view style="padding-top: 30rpx; padding-left: 20rpx; padding-right: 20rpx;">
 						<view style="display:flex; justify-content: space-between;">
 							<view>上传授权书</view>
 							<view style="color: #2E69FF;">下载授权书模板</view>
 						</view>
 						<view style="display: flex;justify-content: space-between; padding: 30rpx 10rpx 30rpx 10rpx;">
 							<u-upload :fileList="fileList6" @afterRead="afterRead" @delete="deletePic" name="6"
 								multiple :maxCount="1" width="150" height="70">
 								<image src="https://www.xrskfw.com/static/images/user/sfz_rx.png" mode="widthFix"
 									style="width: 155px; "></image>
 							</u-upload>
 						</view>

 					</view>

					<view style="padding-top: 200rpx; background-color: #F3F5FC;">
						<u-button 
							style="  background-color: #2E69FF; font-weight: 500; width: 95%; "
							type="primary"
							@click="gonext"
							>下一步</u-button>
					</view>
 				</view>

 				 
 			</view>

 			<view v-if="currentidx===1">
 				<view style="padding-top: 30rpx;padding-left: 20rpx; padding-right: 20rpx; background-color: #FFF;">
 					<view style="display:flex; justify-content: space-between;">
 						<view>上传营业执照</view>
 					</view>
 					<view style="display: flex;justify-content: space-between; padding: 30rpx 10rpx 30rpx 10rpx;">
 						<u-upload :fileList="fileList6" @afterRead="afterRead" @delete="deletePic" name="6" multiple
 							:maxCount="1" width="150" height="70">
 							<image src="https://www.xrskfw.com/static/images/user/sfz_rx.png" mode="widthFix"
 								style="width: 155px; "></image>
 						</u-upload>
 					</view>
 					<view class="uni-form-item">
 						<view class="uni-form-item-label uni-form-item-required">企业注册名称</view>
 						<view class="uni-form-item-input">
 							<input class="uni-input" placeholder="请输入营业执照上的全称" :placeholder-style="placeholderStyle"
 								:disabled="readonly" />
 						</view>
 					</view>
 					<view class="uni-form-item">
 						<view class="uni-form-item-label uni-form-item-required">公司地址</view>
 						<view class="uni-form-item-input">
 							<input class="uni-input" placeholder="请填写公司办公地址" :placeholder-style="placeholderStyle"
 								:disabled="readonly" />
 						</view>
 					</view>
 					<view class="uni-form-item">
 						<view class="uni-form-item-label uni-form-item-required">营业执照号</view>
 						<view class="uni-form-item-input">
 							<input class="uni-input" placeholder="请输入营业执照号" :placeholder-style="placeholderStyle"
 								:disabled="readonly" />
 						</view>
 					</view>
 				</view>

 				<view style="padding-top: 200rpx;">
 					<u-button 
 						style="  background-color: #2E69FF; font-weight: 500; width: 95%; "
 						type="primary" @click="goAuthor">提交认证</u-button>
 				</view>
 			</view>


 		</view>

 	</view>
 </template>


 <script>
 	export default {
 		data() {
 			return {
 				currentidx: 0,
 				content: ``,
 				fileList5: []
 			};
 		},
 		onLoad() {
 			console.log("token", uni.getStorageSync('token'))
 		},
 		methods: {
			goAuthor(){
				this.currentidx = 2;
			},
			gonext(){
				this.currentidx = 1;
			},
 			// 删除图片
 			deletePic(event) {
 				this[`fileList${event.name}`].splice(event.index, 1)
 			},
 			// 新增图片
 			async afterRead(event) {
 				// 当设置 multiple 为 true 时, file 为数组格式，否则为对象格式
 				let lists = [].concat(event.file)
 				let fileListLen = this[`fileList${event.name}`].length
 				lists.map((item) => {
 					this[`fileList${event.name}`].push({
 						...item,
 						status: 'uploading',
 						message: '上传中'
 					})
 				})
 				for (let i = 0; i < lists.length; i++) {
 					const result = await this.uploadFilePromise(lists[i].url)
 					let item = this[`fileList${event.name}`][fileListLen]
 					this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
 						status: 'success',
 						message: '',
 						url: result
 					}))
 					fileListLen++
 				}
 			},
 			uploadFilePromise(url) {

 				return new Promise((resolve, reject) => {
 					let a = uni.uploadFile({
 						url: 'https://www.xrskfw.com/api/blade-resource/oss/endpoint/put-file', // 仅为示例，非真实的接口地址									 
 						filePath: url,
 						name: 'file',
 						header: {
 							"Content-Type": "multipart/form-data",
 							'Authorization': 'Basic d3hhcHA6d3hhcHBfc2VjcmV0',
 							'Blade-Auth': 'bearer ' + uni.getStorageSync('token').content
 						},
 						formData: {

 						},
 						success: (res) => {
 							setTimeout(() => {
 								console.log(res)
 								resolve(res.data.data)
 							}, 1000)
 						}
 					});
 				})
 			},
 		}
 	};
 </script>

 <style lang="scss" scoped>
 	.container {
 		padding: 0 0 150rpx;
 		height: 100vh;
 	}

 	.nav-item-img {
 		width: 150rpx;
 	}

 	.uni-form-item {
 		display: flex;
 		width: 100%;
 		padding: 20rpx 0rpx 20rpx 0rpx;
 		justify-content: space-between;
 		border-bottom: 1px solid #dddddd;

 		.uni-input {
 			text-align: right;
 		}

 	}
 </style>